<template>
    <h3>Ref</h3>
    <p>nameRef {{nameRef}}</p>
    <p>ageRef {{ageRef}}</p>
</template>

<script>
import {ref} from "vue"

export default {
    setup(props,context) {
        console.log('Ref setup',props,context);

        const nameRef = ref("steve")
        const ageRef = ref(18)

        /* 让数据自动变化 */
        setInterval(() => {
            ageRef.value ++
        }, 1000);

        /* 返回响应式给模板 */
        return {
            nameRef,
            ageRef
        }
    }
}
</script>